package com.jishi.Listener;
import java.awt.event.*;
import java.util.Random;

import javax.swing.ImageIcon;
import javax.swing.JButton;
public class IconListener implements ActionListener{
	JButton bt = null;
	ImageIcon[] icon = new ImageIcon[10];
	public IconListener(JButton bt){
		this.bt = bt;
		
		for(int i=0;i<10;i++){
			String s = "image\\"+i+".gif";
			icon[i] = new ImageIcon(s);
		}
	}
	public void actionPerformed(ActionEvent e) {
		int i = new Random().nextInt(10);
		bt.setIcon(icon[Math.abs(i)]);
	}
}
